#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <string>
#include <set>
using namespace std;
int month_28[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
struct date
{
    int year;
    int month;
    int day;
    date(int y, int m, int d)
    {
        year = y;
        month = m;
        day = d;
    }
    bool operator<(date other) const
    {
        if (year == other.year)
        {
            if (month == other.month)
                return day < other.day;
            return month < other.month;
        }
        return year < other.year;
    }
    bool vial()
    { //判断日期是否非法
        if (year < 1960 || year > 2059)
            return false;
        if (month <= 0 || month > 12)
            return false;
        if (year % 400 == 0 || year % 100 != 0 && year % 4 == 0)
        {
            //闰年
            if (month == 2)
            {
                return day >= 1 && day <= 29;
            }
            return day >= 1 && day <= month_28[month];
        }
        else
        {
            return day >= 1 && day <= month_28[month];
        }
    }
    void print() const
    {
        printf("%d-%02d-%02d\n", year, month, day);
    }
};

set<date> ss; //利用set容器来去重排序

void insert(int a, int b, int c)
{
    date obj(a, b, c);
    if (obj.vial())
        ss.insert(obj);
}
int main()
{
    int a, b, c;
    scanf("%d/%d/%d", &a, &b, &c);
    //年月日
    insert(1900 + a, b, c);
    insert(2000 + a, b, c);
    //月日年
    insert(1900 + c, a, b);
    insert(2000 + c, a, b);
    //日月年
    insert(1900 + c, b, a);
    insert(2000 + c, b, a);

    set<date>::iterator it = ss.begin();
    for (; it != ss.end(); it++)
    {
        it->print();
    }
    return 0;
}